//
//  SettingController.m
//  i5db
//
//  Created by iMuse on 15-5-19.
//  Copyright (c) 2015年 mySelf. All rights reserved.
//

#import "SettingController.h"
#import "AppButtonView.h"
#import "LoginController.h"
#import "AppDelegate.h"
#import "FeedbackController.h"
#import "AlertLoginOutView.h"
#import "CooperateController.h"
@interface SettingController ()<onButtonDelegate>

@end

@implementation SettingController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"设置";
    }
    return self;
}

-(void) updateViewConstraints
{
    [super updateViewConstraints];
}
-(void) initNavigationBar
{
    [super initNavigationBar];
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view setNeedsUpdateConstraints];
    [self initNavigationBar];
    [self initView];
   
}

-(void) initView
{
    
    
    
    
     AppButtonView * message = [AppButtonView newAutoLayoutView];
     message.delegate = self;
     message.tag      = 2;
     [message setLeftText:@"留言反馈"];
     [message hiddenLine];
     [self.view addSubview:message];
     [message  autoPinToTopLayoutGuideOfViewController:self withInset:10];
     [message autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
     [message autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
     [message autoSetDimension:ALDimensionHeight toSize:40];
    
    
    
    AppButtonView * aboutOur = [AppButtonView newAutoLayoutView];
    [self.view addSubview:aboutOur];
    aboutOur.delegate = self;
    aboutOur.tag      = 1;
    [aboutOur setLeftText:@"关于i5bd"];
    [aboutOur autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:message withOffset:10];
    [aboutOur autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [aboutOur autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [aboutOur autoSetDimension:ALDimensionHeight toSize:40];
    
    
    
    AppButtonView * outBtn = [AppButtonView newAutoLayoutView];
    outBtn.delegate = self;
    outBtn.tag      = 3;
    [outBtn hiddenLine];
    [outBtn setLeftText:@"退出登陆"];
    [self.view addSubview:outBtn];
    [outBtn autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:aboutOur withOffset:0];
    [outBtn autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [outBtn autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [outBtn autoSetDimension:ALDimensionHeight toSize:40];
    
}
-(void)onTapButton:(NSMutableDictionary*)_dic
{
    NSInteger tag = [[_dic valueForKey:@"tag"] integerValue];
    if (tag==3)
    {
       
        [AlertLoginOutView alertLoginOut:self];
         
     
    }else if(tag==2)
    {
        FeedbackController * controller = [[FeedbackController alloc] init];
        [self.navigationController pushViewController:controller animated:YES];
    }
    
}
- (void)viewWillAppear:(BOOL)animated {
    
    
    [[self rdv_tabBarController] setTabBarHidden:YES animated:NO];
    [super viewWillAppear:animated];
    
    
}


- (void)viewWillDisappear:(BOOL)animated {
    
    [[self rdv_tabBarController] setTabBarHidden:NO animated:NO];
    
    [super viewWillDisappear:animated];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
  
}



@end
